using System;
using System.Data;
using System.Data.OleDb;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class _Detail : System.Web.UI.Page 
{
    public int ItemID;
    public int PageNumber;
    public int CategoryID;
    protected void Page_Load(object sender, EventArgs e)
    {
        DAL Data = new DAL();
        int x = 0;
        CategoryID = 0;
        PageNumber = 0;
        ItemID = 0;


        // determine the category id (used for passback)
        if (Int32.TryParse(Request.QueryString["category"], out x)) {
            CategoryID = x; }
        
        // determine the page number (used for passback)
        if (Int32.TryParse(Request.QueryString["page"], out x)) {
            PageNumber = x; }

        // determine the item id
        if (Int32.TryParse(Request.QueryString["item"], out x)) {
            ItemID = x; }

        OleDbDataReader ItemDetails = DAL.GetItemDetails(ItemID);
        
        if (ItemDetails.HasRows)
        {
            ItemDetails.Read();
            
            // set the item picture
            ItemImage.ImageUrl = "/Products/Pictures/" + ItemDetails["Thumbnail"].ToString();
            
            // set the item caption
            ItemCaption.Text = ItemDetails["Description"].ToString();
        }
        ItemDetails.Close();
    }
}
